<!--基本业务查询-大小额基本业务查询-->
<template>
  <div class="app-container">
    <ht-search-form
      :dictMap="dictMap"
      :queryParams="queryParams"
      :outputQueryParams="queryParams"
      :formOptions="formOptions"
      :advOptions="[]"
    ></ht-search-form>
    <ht-table
      ref="dataTable"
      rowKey="coreId"
      :showSerialNumber="false"
      :multi-select="false"
      :dictMap="dictMap"
      :reqConfig="reqConfig"
      :queryParams="queryParams"
      :tableBindColumns="tableBindColumns"
    >
      <template v-slot:operate>
        <el-table-column label="操作" align="left" width="120" fixed="right" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <ht-button-group
              :buttonList="[
                {
                  label: '明细',
                  doFunc: () => {
                    toViewDetail(scope.row);
                  },
                },
              ]"
            />
          </template>
        </el-table-column>
      </template>
    </ht-table>
    <query-detail-dialog ref="queryDetailDialog" :formData.sync="formData" :dictMap="dictMap"></query-detail-dialog>
  </div>
</template>
<script>
import { apiUrlConfig, detail } from "@/api/cnaps/baseBiz/inquire/cash/index";
import QueryDetailDialog from "./components/QueryDetails.vue";
import { listPageMixin } from "@/libs/listPageMixin";
import AmountRangeSearch from "@/views/components/AmountSearchInput";
export default {
  name: "baseBizInqIndex",
  mixins: [listPageMixin],
  components: {
    AmountRangeSearch,
    QueryDetailDialog,
  },
  data() {
    return {
      reqConfig: apiUrlConfig,
      //数据字典
      formData: {},
      searchFormDictList: ["TXN_STATUS","DRCTCODE","PKG_TYPE","PAYMENT_TYPE","STORE_TYPE","PKG_STATUS","PRIORITY3CODE"],
      // 日期范围
      dateRange: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        id: "",
        cpgdate: "",
        cpgdate2: "",
        workdate: "",
        workdate2: "",
        drct: "",
        sysCode: "",
        procStatus: "",
        pkgNo: "",
        payerActno: "",
        payeeActno: "",
        amount1: "",
        amount2: "",
        source: "",
      },
      formOptions: [],
      tableBindColumns: [
        { label: `系统流水号`, prop: "id", width: "160" },
        { label: `内部机构号`, prop: "brno", dictCode: "Cnaps2Dict.CP2_BRNO", width: "160" },
        { label: `CPG日期`, prop: "workdate", sortable: false, width: 160 },
        { label: `ACS核算主体名称`, prop: "acsAcctName", width: 200 },
        { label: `ACS网点名称`, prop: "acsBrname", width: 200 },
        { label: `ACS记账账户名称`, prop: "acsName", width: 200 },
        { label: `货金机构名称`, prop: "instnOrgname", width: 200 },
        {
          label: `交易金额`,
          prop: "amount",
          type: "price",
          sortable: false,
        },
        {
          label: `通讯状态`,
          prop: "status",
          dictCode: "Cnaps2Dict.PKG_STATUS",
          sortable: false,
          width: 180,
        },
      ],
    };
  },
  mounted() {
    this.formOptions = [
      {
        type: "input",
        prop: "id",
        defaultAttr: {
          label: "流水号",
          placeholder: "请输入交易流水号",
        },
      },
      {
        type: "dates",
        nameObj: {
          startTimeName: "cpgdate",
          endTimeName: "cpgdate2",
        },
        defaultAttr: {
          label: "CPG日期",
          placeholder: ["请输入开始日期", "请输入结束日期"],
          format: "yyyy-MM-dd",
          valueFormat: "yyyyMMdd",
        },
      },
    ];
  },
  methods: {
    editComplete(state) {
      console.log("editComplete", state);
      if (state == true) {
        this.getList();
      }
    },
    /** todo 查询当天操作员的交易记录 */
    getList() {
      this.doQuery();
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    transAdd() {
      console.log("this.$refs.editInfoDialog", this.$refs.editInfoDialog);
      this.$refs.editInfoDialog.show();
    },
    /*查看明细*/
    toViewDetail(row) {
      detail({ id: row.id }).then((res) => {
        this.formData = res.result;
      });
      this.$refs.queryDetailDialog.show();
    },
    /*'02-复核拒绝', '04-审核拒绝', '16-授权拒绝' 可以修改*/
    toEdit(row) {
      console.log("this.$refs.editInfoDialog", this.$refs.editInfoDialog);
      this.$refs.editInfoDialog.show(row.coreId, row.pkgNo);
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}
</style>
